package com.TetrisII.views;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URL;
import java.util.Timer;

import javax.swing.JButton;
import javax.swing.JPanel;
/**
 * 控制面板，有速度，等级，开始，暂定等按钮
 * @author Administrator
 *
 */
public class ControlPanel extends JPanel {

	public ControlPanel() {
		// TODO Auto-generated constructor stub		
		setLayout(new FlowLayout());	
		setBackground(Color.white);
		setPreferredSize(new Dimension(200, 200));
		setVisible(true);
		}
/**
 * 画出游戏说明面板
 */
	@Override
	protected void paintComponent(Graphics g) {
		// TODO Auto-generated method stub
		super.paintComponent(g);
		Graphics2D g_2 = (Graphics2D) g;
		URL url=ControlPanel.class.getResource("控制说明.jpg");
		Image image=Toolkit.getDefaultToolkit().getImage(url);
		g_2.drawImage(image, 0, 0, 200, 200, this);
		g.setColor(Color.BLACK);
		g.setFont(new Font("Serif",Font.BOLD,15));
		g.drawString("操作说明:", 70,30);
		g.setFont(new Font("Serif",Font.BOLD,12));
		g.drawString("左移:  ←", 40,50);
		g.drawString("右移:  →", 40,70);
		g.drawString("下移:  ↓", 40,90);
		g.drawString("变形:  ↑", 40,110);
		g.drawString("一键下落:  space", 40,130);
		g.drawString("暂停:  P", 40,150);	
		g.drawString("继续:  R", 40,170);
	
		
		
		
		
	}

}
